﻿
@{
    ViewBag.Title = "Position";
    Layout = "~/Views/Shared/Index.cshtml";
}
@model List<YaYun.Models.Position>

<h2>职位信息</h2>

<table class="layui-table layui-form">
    <tr>
        <th class="emp_id_td">序号</th>
        <th class="emp_tr_t">主管姓名</th>
        <th class="emp_tr_t">职位名称</th>
        <th class="emp_tr_t">描述</th>
        <th class="emp_tr_t">部门</th>

    </tr>
    @foreach (var item in Model)
    {
        <tr class="tr_hover">
            <td class="emp_id_td">@item.posi_id</td>
            <td class="emp_tr_t">@item.Employee.EmployeeName</td>
            <td class="emp_tr_t">@item.PositionName</td>
            <td class="emp_tr_t">@item.description</td>
            <td class="emp_tr_t">@item.Department.DepartmentName</td>

        </tr>
    }
</table>
<div class="demo-laypage-pn-show">
    @Html.ActionLink("上一页", "Position", new { page = ViewBag.CurrentPage - 1 }, new { @class = "layui-btn" })
    @for (int i = 1; i <= ViewBag.TotalPages; i++)
    {
        if (i == ViewBag.CurrentPage)
        {
            @Html.Label($"{@i}", new { @class = "layui-btn layui-btn-sm layui-btn-warm" }) ;
        }
        else
        {
            @Html.ActionLink(i.ToString(), "Position", new { page = i }, new { @class = "layui-btn layui-btn-primary layui-btn-sm" });
        }
        <script>
            layui.use(function () {
                var laypage = layui.laypage;
                var layer = layui.layer;
                // 只显示上一页、下一页、当前页
                laypage.render({
                    elem: 'demo-laypage-pn-show',
                    count: @i,
                    groups: 1,
                    first: false,
                    last: false,
                    layout: ['prev', 'page', 'next'],
                    jump: function (obj, first) {
                        // 首次不执行
                        if (!first) {
                            layer.msg('第 ' + obj.curr + ' 页');
                        }
                    }
                });
            });
        </script>
    }
    @Html.ActionLink("下一页", "Position", new { page = ViewBag.CurrentPage + 1 }, new { @class = "layui-btn" })
</div>
